import com.chilkatsoft.CkMailMan;
import com.chilkatsoft.CkEmail;

public class SmtpSsl {
	
	
  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
}
	

	private int k;
  public SmtpSsl(String deLa,String La,String Subiect,String Mesaj)
  {
  	// Instantiate a mailman object for sending.
    CkMailMan mailman = new CkMailMan();
    mailman.UnlockComponent("anything");
    
    // Set your SMTP server's hostname
    mailman.put_SmtpHost("smtp.gmail.com");
    
	// Set SSL properties:
	mailman.put_SmtpPort(465);
	mailman.put_SmtpSsl(true);

    // If your SMTP server requires a login, set username/password
    mailman.put_SmtpUsername("sergiu.tirsina@gmail.com");
    mailman.put_SmtpPassword("relativ1989");
    
    // New email object..
    CkEmail email = new CkEmail();
    email.put_Subject(Subiect);
    email.put_Body(Mesaj);
    email.put_From(deLa);
    
    // Add a few recipients
    email.AddTo("",La);
    
    
    boolean success = mailman.SendEmail(email);
    if (!success)
    {
    	k=-1;
    	
    }
    else 
    	k=1;
    
    
  }
  
  public boolean isSendOk(){
	  if(k==-1)
		  return false;
	  else
		  return true;
  }
 
}